package com.lengxf.mybatis.config;

import com.baomidou.mybatisplus.core.MybatisConfiguration;
import org.apache.ibatis.logging.stdout.StdOutImpl;
import org.apache.ibatis.session.ExecutorType;

public class MybatisConfig {

    public static MybatisConfiguration build(Boolean mapUnderscoreToCamelCase) {
        MybatisConfiguration configuration = new MybatisConfiguration();
        configuration.setLazyLoadingEnabled(true);
        configuration.setUseColumnLabel(true);
        configuration.setCallSettersOnNulls(true);
        configuration.setMultipleResultSetsEnabled(true);
        configuration.setMapUnderscoreToCamelCase(mapUnderscoreToCamelCase);
        configuration.setDefaultExecutorType(ExecutorType.REUSE);
        configuration.setDefaultStatementTimeout(25000);
        configuration.setLogImpl(StdOutImpl.class);
        return configuration;
    }

}
